import App from './App'

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
import md5 from 'js-md5';
import {
	getRandom
} from '@/static/js/utils.js';

import uView from "uview-ui";
Vue.use(uView);
const app = new Vue({
	...App
})
app.$mount()
// #endif

Vue.prototype.$md5 = md5;

Vue.prototype.baseUrl = 'https://d-wenda.bigchun.com';
Vue.prototype.appkey = 'SH10005';
const deviceId = uni.getStorage({
	key: deviceId,
	success(data) {
		Vue.prototype.deviceId = data;
	},
	fail() {
		const id = 'ai' + getRandom(14)
		Vue.prototype.deviceId = id;
		uni.setStorage({
			key: 'deviceId',
			data: id
		})
	}
})

const uid = uni.getStorage({
	key: uid,
	success(data) {
		Vue.prototype.uid = data;
	},
	fail() {
		const id = getRandom(20)
		Vue.prototype.uid = id;
		uni.setStorage({
			key: 'uid',
			data: id
		})
	}
})

Vue.prototype.appSecret = 'fztvzqDkxyDe4dyF72RXdfnBLF';
// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif
